import Vue from 'vue';
import Router from 'vue-router';
import Index from '../page/index/Index';
import Business from '../page/business/Business';
import Information from '../page/information/Information';
import AllVideo from '../page/allVideo/AllVideo';
import VideoDetails from '../page/allVideo/VideoDetails';
import ReleaseHouse from '../page/releaseHouse/ReleaseHouse';
import BuildingReal from '../page/buildingReal/BuildingReal';
import CityIndex from '../page/cityIndex/CityIndex';
import IndexSearch from '../page/search/IndexSearch';
import VideoSearch from '../page/search/VideoSearch';
import TwoHouse from '../page/twoHouse/TwoHouse';
import HouseMap from '../components/common/HouseMap';
import RentingHouse from '../page/rentingHouse/RentingHouse';
import RentingHouseDetails from '../page/rentingHouse/RentingHouseDetails';
// import BigPhoto from '../components/house/BigPhoto';
// import InformationContent from '../components/listComponents/InformationContent';
import LookQu from '../page/lookQu/LookQu';
import QuDetails from '../page/lookQu/QuDetails';
import RealtorWebsite from '../page/realtorWebsite/RealtorWebsite';
import InformationDetails from '../page/information/InformationDetails';
import HouseDetails from '../page/twoHouse/HouseDetails';
import NewHouseDetails from '../page/lookBuild/NewHouseDetails';
import MoreBuildDetails from '../page/lookBuild/MoreBuildDetails';
import Login from '../page/login/Login';
import LookBuild from '../page/lookBuild/LookBuild';
import Test from '../page/Test';
import BuildPhoto from '../page/lookBuild/BuildPhoto';
import GoldMedalPage from '../page/index/GoldMedalPage';
import BuildSearchAgent from '../page/index/BuildSearchAgent';
import WeiTuoHouse from '../page/weiTuoHouse/WeiTuoHouse';
import WeiTuoTwoHouse from '../page/weiTuoHouse/WeiTuoTwoHouse';
import LookHouseBuild from '../page/other/LookHouseBuild';
import MoreBuildNews from '../page/lookBuild/MoreBuildNews';
import BigPhoto from '../components/house/BigPhoto';
import EntrustingRenting from '../page/rentingHouse/EntrustingRenting.vue' // 委托出租
import EntrustingRenting2 from '../page/rentingHouse/EntrustingRenting2.vue' // 委托出租补充内容
import SelectRegion from '../page/rentingHouse/SelectRegion.vue' // 选择区域

Vue.use(Router);

export default new Router({
  // mode: 'history',
  routes: [

    {
      path: '/',
      name: 'Index',
      component: Index,
      meta: {
        keepAlive: true,
        title: '无忧房'
      }
    },
    {
      path: '/Business',
      name: 'Business',
      component: Business
    },
    {
      path: '/Information',
      name: 'Information',
      component: Information,
      meta: {
        // keepAlive: true,
        title: '无忧资讯'
      }
    },
    {
      path: '/AllVideo',
      name: 'AllVideo',
      component: AllVideo,
      meta: {
        keepAlive: true,
        title: '热播视频'
      }
    },
    {
      path: '/VideoDetails/:id',
      name: 'VideoDetails',
      component: VideoDetails,
      meta: {
        // keepAlive: true,
        title: '视频详情'
      }
    },
    {
      path: '/ReleaseHouse',
      name: 'ReleaseHouse',
      component: ReleaseHouse
    },
    {
      path: '/BuildingReal',
      name: 'BuildingReal',
      component: BuildingReal
    },
    {
      path: '/CityIndex',
      name: 'CityIndex',
      component: CityIndex,
      meta: {
        keepAlive: true,
        title: '城市选择'
      }
    },
    {
      path: '/HouseMap',
      name: 'HouseMap',
      component: HouseMap
    },
    {
      path: '/IndexSearch',
      name: 'IndexSearch',
      component: IndexSearch,
      meta: {
        keepAlive: true,
        title: '搜索'
      }
    },

    {
      path: '/VideoSearch',
      name: 'VideoSearch',
      component: VideoSearch
    },
    {
      path: '/TwoHouse',
      name: 'TwoHouse',
      component: TwoHouse,
      meta: {
        title: '二手房源',
        keepAlive: true
      }
    },
    {
      path: '/InformationDetails/:id',
      name: 'InformationDetails',
      component: InformationDetails,
      meta: {
        title: '资讯详情'
      }
    },
    {
      path: '/NewHouseDetails/:id',
      name: 'NewHouseDetails',
      component: NewHouseDetails,
      meta: {
        keepAlive: true,
        title: '楼盘详情'
      }
    },
    {
      path: '/MoreBuildDetails/:id',
      name: 'MoreBuildDetails',
      component: MoreBuildDetails
    },
    {
      path: '/HouseDetails/:id',
      name: 'HouseDetails',
      component: HouseDetails,
      meta: {
        title: '房源详情'
      }
    },
    {
      path: '/QuDetails/:id',
      name: 'QuDetails',
      component: QuDetails
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },
    {
      path: '/Test',
      name: 'Test',
      component: Test,
      meta: {
        title: '分享 测试'
      }
    },
    {
      path: '/LookBuild',
      name: 'LookBuild',
      component: LookBuild
      // meta: {
      //   keepAlive: true
      // }
    },
    {
      path: '/RealtorWebsite/:id',
      name: 'RealtorWebsite',
      component: RealtorWebsite
    },
    {
      path: '/BuildPhoto/:id',
      name: 'BuildPhoto',
      component: BuildPhoto,
      meta: {
        title: '楼盘相册'
      }
    },
    {
      path: '/BigPhoto/:id',
      name: 'BigPhoto',
      component: BigPhoto,
      meta: {
        title: '楼盘相册',
        keepAlive: false
      }
    },
    {
      path: '/GoldMedalPage',
      name: 'GoldMedalPage',
      component: GoldMedalPage
    },
    {
      path: '/BuildSearchAgent',
      name: 'BuildSearchAgent',
      component: BuildSearchAgent
    },
    {
      path: '/MoreBuildNews/:id',
      name: 'MoreBuildNews',
      component: MoreBuildNews,
      meta: {
        title: '楼盘更多信息'
      }
    },
    {
      path: '/LookQu',
      name: 'LookQu',
      component: LookQu
    },
    {
      path: '/RentingHouse',
      name: 'RentingHouse',
      component: RentingHouse
    },
    {
      path: '/RentingHouseDetails/:id',
      name: 'RentingHouseDetails',
      component: RentingHouseDetails
    },
    {
      path: '/WeiTuoHouse',
      name: 'WeiTuoHouse',
      component: WeiTuoHouse,
      meta: {
        title: '委托房源'
      }
    },
    {
      path: '/WeiTuoTwoHouse',
      name: 'WeiTuoTwoHouse',
      component: WeiTuoTwoHouse,
      meta: {
        keepAlive: true,
        title: '委托出售'
      }
    },
    {
      path: '/LookHouseBuild/:id',
      name: 'LookHouseBuild',
      component: LookHouseBuild
    }, 
    {
      path: '/EntrustingRenting',
      name: 'EntrustingRenting',
      component: EntrustingRenting
    },
    {
      path: '/EntrustingRenting2',
      name: 'EntrustingRenting2',
      component: EntrustingRenting2
    },
    {
      path: '/SelectRegion',
      name: 'SelectRegion',
      component: SelectRegion
    }
    // {
    //   path: '/BigPhoto',
    //   name: 'BigPhoto',
    //   component: BigPhoto
    // }
  ],
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop;
      }
      return {
        x: 0,
        y: to.meta.savedPosition || 0
      };
    }
  }
});
